package com.hksj.Intelligentmanagement;

import com.hksj.Intelligentmanagement.config.FilePathProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableScheduling
@SpringBootApplication
@EnableConfigurationProperties(FilePathProperties.class)
@MapperScan(basePackages = {"com.hksj.Intelligentmanagement.mapper", "com.hksj.Intelligentmanagement.auth.mapper", "com.hksj.Intelligentmanagement.mqtt.connectlog"}) //扫描Mapper
public class Intelligentmanagement {

    public static void main(String[] args) {
        SpringApplication.run(Intelligentmanagement.class, args);
    }

//    @Autowired
//    private IMqttClient emqxClient;

//    @Autowired
//    private MqttProperties mqttProperties;
//
//    @PostConstruct
//    public void test() {
//        //连接服务器
//        emqxClient.connect(mqttProperties.getUsername(), mqttProperties.getPassword());
//        //订阅一个主体
//        emqxClient.subscribe("chenzhang/#", QosEnum.Qos2);
//        //开启一个新的线程  每隔5秒向testtopic/123
//        new Thread(() -> {
//            while (true) {
//               // emqxClient.publish("t/456", "publish msa:" + LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE),
//                  emqxClient.publish("chenzhang/456", "{\"did\":\"FH1050502342\",\"utime\":\"2019/11/04 13:49:56\",\"content\":[{\"pid\":\"10\",\"addr\":\"test1\",\"addrv\":\"10\"}]}",
//                        QosEnum.Qos2, false);
//                try {
//                    TimeUnit.SECONDS.sleep(5);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
//            }
//        }).start();
//
//    }

}
